﻿using Domain.Entitys.Sinv;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore.EntityConfigurations.Sinv
{
    public class Sinv_Sale_Return_DetailsConfiguration : IEntityTypeConfiguration<Sinv_Sale_Return>
    {
        public void Configure(EntityTypeBuilder<Sinv_Sale_Return> builder)
        {
            builder.ToTable("sinv_sale_return");
            builder.HasKey(sr => sr.Sale_Return_Id);

            builder.HasMany(sr => sr.Details)
                .WithOne(sr => sr.Main)
                .HasForeignKey(sr => sr.Sale_Return_Id);
        }
    }
}
